from unittest.mock import Mock

import pytest

from tartiflette.language.ast import (
    ArgumentNode,
    BooleanValueNode,
    DirectiveNode,
    DocumentNode,
    EnumValueNode,
    FieldNode,
    FloatValueNode,
    FragmentDefinitionNode,
    FragmentSpreadNode,
    InlineFragmentNode,
    IntValueNode,
    ListTypeNode,
    ListValueNode,
    Location,
    NamedTypeNode,
    NameNode,
    NonNullTypeNode,
    NullValueNode,
    ObjectFieldNode,
    ObjectValueNode,
    OperationDefinitionNode,
    SelectionSetNode,
    StringValueNode,
    VariableDefinitionNode,
    VariableNode,
)
from tartiflette.language.parsers.libgraphqlparser import parse_to_document
from tartiflette.language.parsers.libgraphqlparser.parser import (
    ParsedData,
    _parse_context_manager,
    _parse_to_json_ast,
)
from tartiflette.types.exceptions.tartiflette import GraphQLSyntaxError


def test_parseddata__enter__():
    c_parsed_mock = Mock()
    destroy_cb_mock = Mock()

    parsed_data = ParsedData(c_parsed_mock, destroy_cb_mock)

    destroy_cb_mock.assert_not_called()

    with parsed_data as parsed:
        assert parsed is c_parsed_mock

    destroy_cb_mock.assert_called_once_with(c_parsed_mock)


@pytest.mark.parametrize("query", [b"{ a }", "{ a }"])
def test_parse_context_manager(query):
    result = _parse_context_manager(query)
    assert isinstance(result, ParsedData)


def test_parse_context_manager_error():
    with pytest.raises(GraphQLSyntaxError):
        _parse_context_manager("{ a { }")


@pytest.mark.parametrize(
    "query,expected",
    [
        (
            b"{ a { a1 a2 } }",
            b'{"kind":"Document","loc":{"start": {"line": 1,"column":1}, "end": {"line":1,"column":16}},"definitions":[{"kind":"OperationDefinition","loc":{"start": {"line": 1,"column":1}, "end": {"line":1,"column":16}},"operation":"query","name":null,"variableDefinitions":null,"directives":null,"selectionSet":{"kind":"SelectionSet","loc":{"start": {"line": 1,"column":1}, "end": {"line":1,"column":16}},"selections":[{"kind":"Field","loc":{"start": {"line": 1,"column":3}, "end": {"line":1,"column":14}},"alias":null,"name":{"kind":"Name","loc":{"start": {"line": 1,"column":3}, "end": {"line":1,"column":4}},"value":"a"},"arguments":null,"directives":null,"selectionSet":{"kind":"SelectionSet","loc":{"start": {"line": 1,"column":5}, "end": {"line":1,"column":14}},"selections":[{"kind":"Field","loc":{"start": {"line": 1,"column":7}, "end": {"line":1,"column":9}},"alias":null,"name":{"kind":"Name","loc":{"start": {"line": 1,"column":7}, "end": {"line":1,"column":9}},"value":"a1"},"arguments":null,"directives":null,"selectionSet":null},{"kind":"Field","loc":{"start": {"line": 1,"column":10}, "end": {"line":1,"column":12}},"alias":null,"name":{"kind":"Name","loc":{"start": {"line": 1,"column":10}, "end": {"line":1,"column":12}},"value":"a2"},"arguments":null,"directives":null,"selectionSet":null}]}}]}}]}',
        ),
        (
            "{ a { a1 a2 } }",
            b'{"kind":"Document","loc":{"start": {"line": 1,"column":1}, "end": {"line":1,"column":16}},"definitions":[{"kind":"OperationDefinition","loc":{"start": {"line": 1,"column":1}, "end": {"line":1,"column":16}},"operation":"query","name":null,"variableDefinitions":null,"directives":null,"selectionSet":{"kind":"SelectionSet","loc":{"start": {"line": 1,"column":1}, "end": {"line":1,"column":16}},"selections":[{"kind":"Field","loc":{"start": {"line": 1,"column":3}, "end": {"line":1,"column":14}},"alias":null,"name":{"kind":"Name","loc":{"start": {"line": 1,"column":3}, "end": {"line":1,"column":4}},"value":"a"},"arguments":null,"directives":null,"selectionSet":{"kind":"SelectionSet","loc":{"start": {"line": 1,"column":5}, "end": {"line":1,"column":14}},"selections":[{"kind":"Field","loc":{"start": {"line": 1,"column":7}, "end": {"line":1,"column":9}},"alias":null,"name":{"kind":"Name","loc":{"start": {"line": 1,"column":7}, "end": {"line":1,"column":9}},"value":"a1"},"arguments":null,"directives":null,"selectionSet":null},{"kind":"Field","loc":{"start": {"line": 1,"column":10}, "end": {"line":1,"column":12}},"alias":null,"name":{"kind":"Name","loc":{"start": {"line": 1,"column":10}, "end": {"line":1,"column":12}},"value":"a2"},"arguments":null,"directives":null,"selectionSet":null}]}}]}}]}',
        ),
    ],
)
def test_parse_to_json_ast(query, expected):
    assert _parse_to_json_ast(query) == expected


@pytest.mark.skip(
    reason="Should be unskipped when a better validation "
    "system which doesn't alter the DocumentNode will "
    "be implemented."
)
@pytest.mark.parametrize(
    "sdl,expected",
    [
        (
            """
            {
              hello
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="query",
                        name=None,
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=13, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=4, column_end=14
                ),
            ),
        ),
        (
            """
            query {
              hello
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="query",
                        name=None,
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=19, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=4, column_end=14
                ),
            ),
        ),
        (
            """
            query NamedQuery {
              hello
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="query",
                        name=NameNode(
                            value="NamedQuery",
                            location=Location(
                                line=2, column=19, line_end=2, column_end=29
                            ),
                        ),
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=30, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=4, column_end=14
                ),
            ),
        ),
        (
            """
            mutation {
              hello
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="mutation",
                        name=None,
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=22, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=4, column_end=14
                ),
            ),
        ),
        (
            """
            mutation NamedMutation {
              hello
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="mutation",
                        name=NameNode(
                            value="NamedMutation",
                            location=Location(
                                line=2, column=22, line_end=2, column_end=35
                            ),
                        ),
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=36, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=4, column_end=14
                ),
            ),
        ),
        (
            """
            subscription {
              hello
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="subscription",
                        name=None,
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=26, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=4, column_end=14
                ),
            ),
        ),
        (
            """
            subscription NamedSubscription {
              hello
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="subscription",
                        name=NameNode(
                            value="NamedSubscription",
                            location=Location(
                                line=2, column=26, line_end=2, column_end=43
                            ),
                        ),
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=44, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=4, column_end=14
                ),
            ),
        ),
        (
            """
            query NamedQuery {
              hello
            }

            mutation NamedMutation {
              hello
            }

            subscription NamedSubscription {
              hello
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="query",
                        name=NameNode(
                            value="NamedQuery",
                            location=Location(
                                line=2, column=19, line_end=2, column_end=29
                            ),
                        ),
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=30, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    ),
                    OperationDefinitionNode(
                        operation_type="mutation",
                        name=NameNode(
                            value="NamedMutation",
                            location=Location(
                                line=6, column=22, line_end=6, column_end=35
                            ),
                        ),
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=7,
                                            column=15,
                                            line_end=7,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=7,
                                        column=15,
                                        line_end=7,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=6, column=36, line_end=8, column_end=14
                            ),
                        ),
                        location=Location(
                            line=6, column=13, line_end=8, column_end=14
                        ),
                    ),
                    OperationDefinitionNode(
                        operation_type="subscription",
                        name=NameNode(
                            value="NamedSubscription",
                            location=Location(
                                line=10, column=26, line_end=10, column_end=43
                            ),
                        ),
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=11,
                                            column=15,
                                            line_end=11,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=11,
                                        column=15,
                                        line_end=11,
                                        column_end=20,
                                    ),
                                )
                            ],
                            location=Location(
                                line=10, column=44, line_end=12, column_end=14
                            ),
                        ),
                        location=Location(
                            line=10, column=13, line_end=12, column_end=14
                        ),
                    ),
                ],
                location=Location(
                    line=2, column=13, line_end=12, column_end=14
                ),
            ),
        ),
        (
            """
            query($name: String!, $limit: Int!) {
              hello(name: $name) @truncate(limit: $limit)
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="query",
                        name=None,
                        variable_definitions=[
                            VariableDefinitionNode(
                                variable=VariableNode(
                                    name=NameNode(
                                        value="name",
                                        location=Location(
                                            line=2,
                                            column=19,
                                            line_end=2,
                                            column_end=24,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=19,
                                        line_end=2,
                                        column_end=24,
                                    ),
                                ),
                                type=NonNullTypeNode(
                                    type=NamedTypeNode(
                                        name=NameNode(
                                            value="String",
                                            location=Location(
                                                line=2,
                                                column=26,
                                                line_end=2,
                                                column_end=32,
                                            ),
                                        ),
                                        location=Location(
                                            line=2,
                                            column=26,
                                            line_end=2,
                                            column_end=32,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=26,
                                        line_end=2,
                                        column_end=33,
                                    ),
                                ),
                                default_value=None,
                                location=Location(
                                    line=2,
                                    column=19,
                                    line_end=2,
                                    column_end=33,
                                ),
                            ),
                            VariableDefinitionNode(
                                variable=VariableNode(
                                    name=NameNode(
                                        value="limit",
                                        location=Location(
                                            line=2,
                                            column=35,
                                            line_end=2,
                                            column_end=41,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=35,
                                        line_end=2,
                                        column_end=41,
                                    ),
                                ),
                                type=NonNullTypeNode(
                                    type=NamedTypeNode(
                                        name=NameNode(
                                            value="Int",
                                            location=Location(
                                                line=2,
                                                column=43,
                                                line_end=2,
                                                column_end=46,
                                            ),
                                        ),
                                        location=Location(
                                            line=2,
                                            column=43,
                                            line_end=2,
                                            column_end=46,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=43,
                                        line_end=2,
                                        column_end=47,
                                    ),
                                ),
                                default_value=None,
                                location=Location(
                                    line=2,
                                    column=35,
                                    line_end=2,
                                    column_end=47,
                                ),
                            ),
                        ],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="hello",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="name",
                                                location=Location(
                                                    line=3,
                                                    column=21,
                                                    line_end=3,
                                                    column_end=25,
                                                ),
                                            ),
                                            value=VariableNode(
                                                name=NameNode(
                                                    value="name",
                                                    location=Location(
                                                        line=3,
                                                        column=27,
                                                        line_end=3,
                                                        column_end=32,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=3,
                                                    column=27,
                                                    line_end=3,
                                                    column_end=32,
                                                ),
                                            ),
                                            location=Location(
                                                line=3,
                                                column=21,
                                                line_end=3,
                                                column_end=32,
                                            ),
                                        )
                                    ],
                                    directives=[
                                        DirectiveNode(
                                            name=NameNode(
                                                value="truncate",
                                                location=Location(
                                                    line=3,
                                                    column=35,
                                                    line_end=3,
                                                    column_end=43,
                                                ),
                                            ),
                                            arguments=[
                                                ArgumentNode(
                                                    name=NameNode(
                                                        value="limit",
                                                        location=Location(
                                                            line=3,
                                                            column=44,
                                                            line_end=3,
                                                            column_end=49,
                                                        ),
                                                    ),
                                                    value=VariableNode(
                                                        name=NameNode(
                                                            value="limit",
                                                            location=Location(
                                                                line=3,
                                                                column=51,
                                                                line_end=3,
                                                                column_end=57,
                                                            ),
                                                        ),
                                                        location=Location(
                                                            line=3,
                                                            column=51,
                                                            line_end=3,
                                                            column_end=57,
                                                        ),
                                                    ),
                                                    location=Location(
                                                        line=3,
                                                        column=44,
                                                        line_end=3,
                                                        column_end=57,
                                                    ),
                                                )
                                            ],
                                            location=Location(
                                                line=3,
                                                column=34,
                                                line_end=3,
                                                column_end=58,
                                            ),
                                        )
                                    ],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=58,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=49, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=4, column_end=14
                ),
            ),
        ),
        (
            """
            query {
              booleanArgument(arg1: true, arg2: false)
              enumArgument(arg1: ENUM_VALUE)
              floatArgument(arg1: 0.0, arg2: 10.20, arg3: 1e3,
              arg4: 1.234e2, arg5: -1.234e2)
              intArgument(arg1: 0, arg2: 10, arg3: -10)
              nullArgument(arg1: null)
              stringArgument(arg1: "", arg2: "STRING_VALUE")
              listArgument(arg1: [], arg2: [true, ENUM_VALUE, -1.234e2, -10,
              null, "STRING_VALUE"])
              objectArgument(arg1: {}, arg2: {
                boolean: true
                enum: ENUM_VALUE
                float: -1.234e2
                int: -10
                null: null
                string: "STRING_VALUE"
              })
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="query",
                        name=None,
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="booleanArgument",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=30,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg1",
                                                location=Location(
                                                    line=3,
                                                    column=31,
                                                    line_end=3,
                                                    column_end=35,
                                                ),
                                            ),
                                            value=BooleanValueNode(
                                                value=True,
                                                location=Location(
                                                    line=3,
                                                    column=37,
                                                    line_end=3,
                                                    column_end=41,
                                                ),
                                            ),
                                            location=Location(
                                                line=3,
                                                column=31,
                                                line_end=3,
                                                column_end=41,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg2",
                                                location=Location(
                                                    line=3,
                                                    column=43,
                                                    line_end=3,
                                                    column_end=47,
                                                ),
                                            ),
                                            value=BooleanValueNode(
                                                value=False,
                                                location=Location(
                                                    line=3,
                                                    column=49,
                                                    line_end=3,
                                                    column_end=54,
                                                ),
                                            ),
                                            location=Location(
                                                line=3,
                                                column=43,
                                                line_end=3,
                                                column_end=54,
                                            ),
                                        ),
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=55,
                                    ),
                                ),
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="enumArgument",
                                        location=Location(
                                            line=4,
                                            column=15,
                                            line_end=4,
                                            column_end=27,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg1",
                                                location=Location(
                                                    line=4,
                                                    column=28,
                                                    line_end=4,
                                                    column_end=32,
                                                ),
                                            ),
                                            value=EnumValueNode(
                                                value="ENUM_VALUE",
                                                location=Location(
                                                    line=4,
                                                    column=34,
                                                    line_end=4,
                                                    column_end=44,
                                                ),
                                            ),
                                            location=Location(
                                                line=4,
                                                column=28,
                                                line_end=4,
                                                column_end=44,
                                            ),
                                        )
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=4,
                                        column=15,
                                        line_end=4,
                                        column_end=45,
                                    ),
                                ),
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="floatArgument",
                                        location=Location(
                                            line=5,
                                            column=15,
                                            line_end=5,
                                            column_end=28,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg1",
                                                location=Location(
                                                    line=5,
                                                    column=29,
                                                    line_end=5,
                                                    column_end=33,
                                                ),
                                            ),
                                            value=FloatValueNode(
                                                value=0.0,
                                                location=Location(
                                                    line=5,
                                                    column=35,
                                                    line_end=5,
                                                    column_end=38,
                                                ),
                                            ),
                                            location=Location(
                                                line=5,
                                                column=29,
                                                line_end=5,
                                                column_end=38,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg2",
                                                location=Location(
                                                    line=5,
                                                    column=40,
                                                    line_end=5,
                                                    column_end=44,
                                                ),
                                            ),
                                            value=FloatValueNode(
                                                value=10.20,
                                                location=Location(
                                                    line=5,
                                                    column=46,
                                                    line_end=5,
                                                    column_end=51,
                                                ),
                                            ),
                                            location=Location(
                                                line=5,
                                                column=40,
                                                line_end=5,
                                                column_end=51,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg3",
                                                location=Location(
                                                    line=5,
                                                    column=53,
                                                    line_end=5,
                                                    column_end=57,
                                                ),
                                            ),
                                            value=FloatValueNode(
                                                value=1000.0,
                                                location=Location(
                                                    line=5,
                                                    column=59,
                                                    line_end=5,
                                                    column_end=62,
                                                ),
                                            ),
                                            location=Location(
                                                line=5,
                                                column=53,
                                                line_end=5,
                                                column_end=62,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg4",
                                                location=Location(
                                                    line=6,
                                                    column=15,
                                                    line_end=6,
                                                    column_end=19,
                                                ),
                                            ),
                                            value=FloatValueNode(
                                                value=123.4,
                                                location=Location(
                                                    line=6,
                                                    column=21,
                                                    line_end=6,
                                                    column_end=28,
                                                ),
                                            ),
                                            location=Location(
                                                line=6,
                                                column=15,
                                                line_end=6,
                                                column_end=28,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg5",
                                                location=Location(
                                                    line=6,
                                                    column=30,
                                                    line_end=6,
                                                    column_end=34,
                                                ),
                                            ),
                                            value=FloatValueNode(
                                                value=-123.4,
                                                location=Location(
                                                    line=6,
                                                    column=36,
                                                    line_end=6,
                                                    column_end=44,
                                                ),
                                            ),
                                            location=Location(
                                                line=6,
                                                column=30,
                                                line_end=6,
                                                column_end=44,
                                            ),
                                        ),
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=5,
                                        column=15,
                                        line_end=6,
                                        column_end=45,
                                    ),
                                ),
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="intArgument",
                                        location=Location(
                                            line=7,
                                            column=15,
                                            line_end=7,
                                            column_end=26,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg1",
                                                location=Location(
                                                    line=7,
                                                    column=27,
                                                    line_end=7,
                                                    column_end=31,
                                                ),
                                            ),
                                            value=IntValueNode(
                                                value=0,
                                                location=Location(
                                                    line=7,
                                                    column=33,
                                                    line_end=7,
                                                    column_end=34,
                                                ),
                                            ),
                                            location=Location(
                                                line=7,
                                                column=27,
                                                line_end=7,
                                                column_end=34,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg2",
                                                location=Location(
                                                    line=7,
                                                    column=36,
                                                    line_end=7,
                                                    column_end=40,
                                                ),
                                            ),
                                            value=IntValueNode(
                                                value=10,
                                                location=Location(
                                                    line=7,
                                                    column=42,
                                                    line_end=7,
                                                    column_end=44,
                                                ),
                                            ),
                                            location=Location(
                                                line=7,
                                                column=36,
                                                line_end=7,
                                                column_end=44,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg3",
                                                location=Location(
                                                    line=7,
                                                    column=46,
                                                    line_end=7,
                                                    column_end=50,
                                                ),
                                            ),
                                            value=IntValueNode(
                                                value=-10,
                                                location=Location(
                                                    line=7,
                                                    column=52,
                                                    line_end=7,
                                                    column_end=55,
                                                ),
                                            ),
                                            location=Location(
                                                line=7,
                                                column=46,
                                                line_end=7,
                                                column_end=55,
                                            ),
                                        ),
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=7,
                                        column=15,
                                        line_end=7,
                                        column_end=56,
                                    ),
                                ),
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="nullArgument",
                                        location=Location(
                                            line=8,
                                            column=15,
                                            line_end=8,
                                            column_end=27,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg1",
                                                location=Location(
                                                    line=8,
                                                    column=28,
                                                    line_end=8,
                                                    column_end=32,
                                                ),
                                            ),
                                            value=NullValueNode(
                                                location=Location(
                                                    line=8,
                                                    column=34,
                                                    line_end=8,
                                                    column_end=38,
                                                )
                                            ),
                                            location=Location(
                                                line=8,
                                                column=28,
                                                line_end=8,
                                                column_end=38,
                                            ),
                                        )
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=8,
                                        column=15,
                                        line_end=8,
                                        column_end=39,
                                    ),
                                ),
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="stringArgument",
                                        location=Location(
                                            line=9,
                                            column=15,
                                            line_end=9,
                                            column_end=29,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg1",
                                                location=Location(
                                                    line=9,
                                                    column=30,
                                                    line_end=9,
                                                    column_end=34,
                                                ),
                                            ),
                                            value=StringValueNode(
                                                value="",
                                                location=Location(
                                                    line=9,
                                                    column=36,
                                                    line_end=9,
                                                    column_end=38,
                                                ),
                                            ),
                                            location=Location(
                                                line=9,
                                                column=30,
                                                line_end=9,
                                                column_end=38,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg2",
                                                location=Location(
                                                    line=9,
                                                    column=40,
                                                    line_end=9,
                                                    column_end=44,
                                                ),
                                            ),
                                            value=StringValueNode(
                                                value="STRING_VALUE",
                                                location=Location(
                                                    line=9,
                                                    column=46,
                                                    line_end=9,
                                                    column_end=60,
                                                ),
                                            ),
                                            location=Location(
                                                line=9,
                                                column=40,
                                                line_end=9,
                                                column_end=60,
                                            ),
                                        ),
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=9,
                                        column=15,
                                        line_end=9,
                                        column_end=61,
                                    ),
                                ),
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="listArgument",
                                        location=Location(
                                            line=10,
                                            column=15,
                                            line_end=10,
                                            column_end=27,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg1",
                                                location=Location(
                                                    line=10,
                                                    column=28,
                                                    line_end=10,
                                                    column_end=32,
                                                ),
                                            ),
                                            value=ListValueNode(
                                                values=[],
                                                location=Location(
                                                    line=10,
                                                    column=34,
                                                    line_end=10,
                                                    column_end=36,
                                                ),
                                            ),
                                            location=Location(
                                                line=10,
                                                column=28,
                                                line_end=10,
                                                column_end=36,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg2",
                                                location=Location(
                                                    line=10,
                                                    column=38,
                                                    line_end=10,
                                                    column_end=42,
                                                ),
                                            ),
                                            value=ListValueNode(
                                                values=[
                                                    BooleanValueNode(
                                                        value=True,
                                                        location=Location(
                                                            line=10,
                                                            column=45,
                                                            line_end=10,
                                                            column_end=49,
                                                        ),
                                                    ),
                                                    EnumValueNode(
                                                        value="ENUM_VALUE",
                                                        location=Location(
                                                            line=10,
                                                            column=51,
                                                            line_end=10,
                                                            column_end=61,
                                                        ),
                                                    ),
                                                    FloatValueNode(
                                                        value=-123.4,
                                                        location=Location(
                                                            line=10,
                                                            column=63,
                                                            line_end=10,
                                                            column_end=71,
                                                        ),
                                                    ),
                                                    IntValueNode(
                                                        value=-10,
                                                        location=Location(
                                                            line=10,
                                                            column=73,
                                                            line_end=10,
                                                            column_end=76,
                                                        ),
                                                    ),
                                                    NullValueNode(
                                                        location=Location(
                                                            line=11,
                                                            column=15,
                                                            line_end=11,
                                                            column_end=19,
                                                        )
                                                    ),
                                                    StringValueNode(
                                                        value="STRING_VALUE",
                                                        location=Location(
                                                            line=11,
                                                            column=21,
                                                            line_end=11,
                                                            column_end=35,
                                                        ),
                                                    ),
                                                ],
                                                location=Location(
                                                    line=10,
                                                    column=44,
                                                    line_end=11,
                                                    column_end=36,
                                                ),
                                            ),
                                            location=Location(
                                                line=10,
                                                column=38,
                                                line_end=11,
                                                column_end=36,
                                            ),
                                        ),
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=10,
                                        column=15,
                                        line_end=11,
                                        column_end=37,
                                    ),
                                ),
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="objectArgument",
                                        location=Location(
                                            line=12,
                                            column=15,
                                            line_end=12,
                                            column_end=29,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg1",
                                                location=Location(
                                                    line=12,
                                                    column=30,
                                                    line_end=12,
                                                    column_end=34,
                                                ),
                                            ),
                                            value=ObjectValueNode(
                                                fields=[],
                                                location=Location(
                                                    line=12,
                                                    column=36,
                                                    line_end=12,
                                                    column_end=38,
                                                ),
                                            ),
                                            location=Location(
                                                line=12,
                                                column=30,
                                                line_end=12,
                                                column_end=38,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="arg2",
                                                location=Location(
                                                    line=12,
                                                    column=40,
                                                    line_end=12,
                                                    column_end=44,
                                                ),
                                            ),
                                            value=ObjectValueNode(
                                                fields=[
                                                    ObjectFieldNode(
                                                        name=NameNode(
                                                            value="boolean",
                                                            location=Location(
                                                                line=13,
                                                                column=17,
                                                                line_end=13,
                                                                column_end=24,
                                                            ),
                                                        ),
                                                        value=BooleanValueNode(
                                                            value=True,
                                                            location=Location(
                                                                line=13,
                                                                column=26,
                                                                line_end=13,
                                                                column_end=30,
                                                            ),
                                                        ),
                                                        location=Location(
                                                            line=13,
                                                            column=17,
                                                            line_end=13,
                                                            column_end=30,
                                                        ),
                                                    ),
                                                    ObjectFieldNode(
                                                        name=NameNode(
                                                            value="enum",
                                                            location=Location(
                                                                line=14,
                                                                column=17,
                                                                line_end=14,
                                                                column_end=21,
                                                            ),
                                                        ),
                                                        value=EnumValueNode(
                                                            value="ENUM_VALUE",
                                                            location=Location(
                                                                line=14,
                                                                column=23,
                                                                line_end=14,
                                                                column_end=33,
                                                            ),
                                                        ),
                                                        location=Location(
                                                            line=14,
                                                            column=17,
                                                            line_end=14,
                                                            column_end=33,
                                                        ),
                                                    ),
                                                    ObjectFieldNode(
                                                        name=NameNode(
                                                            value="float",
                                                            location=Location(
                                                                line=15,
                                                                column=17,
                                                                line_end=15,
                                                                column_end=22,
                                                            ),
                                                        ),
                                                        value=FloatValueNode(
                                                            value=-123.4,
                                                            location=Location(
                                                                line=15,
                                                                column=24,
                                                                line_end=15,
                                                                column_end=32,
                                                            ),
                                                        ),
                                                        location=Location(
                                                            line=15,
                                                            column=17,
                                                            line_end=15,
                                                            column_end=32,
                                                        ),
                                                    ),
                                                    ObjectFieldNode(
                                                        name=NameNode(
                                                            value="int",
                                                            location=Location(
                                                                line=16,
                                                                column=17,
                                                                line_end=16,
                                                                column_end=20,
                                                            ),
                                                        ),
                                                        value=IntValueNode(
                                                            value=-10,
                                                            location=Location(
                                                                line=16,
                                                                column=22,
                                                                line_end=16,
                                                                column_end=25,
                                                            ),
                                                        ),
                                                        location=Location(
                                                            line=16,
                                                            column=17,
                                                            line_end=16,
                                                            column_end=25,
                                                        ),
                                                    ),
                                                    ObjectFieldNode(
                                                        name=NameNode(
                                                            value="null",
                                                            location=Location(
                                                                line=17,
                                                                column=17,
                                                                line_end=17,
                                                                column_end=21,
                                                            ),
                                                        ),
                                                        value=NullValueNode(
                                                            location=Location(
                                                                line=17,
                                                                column=23,
                                                                line_end=17,
                                                                column_end=27,
                                                            )
                                                        ),
                                                        location=Location(
                                                            line=17,
                                                            column=17,
                                                            line_end=17,
                                                            column_end=27,
                                                        ),
                                                    ),
                                                    ObjectFieldNode(
                                                        name=NameNode(
                                                            value="string",
                                                            location=Location(
                                                                line=18,
                                                                column=17,
                                                                line_end=18,
                                                                column_end=23,
                                                            ),
                                                        ),
                                                        value=StringValueNode(
                                                            value="STRING_VALUE",
                                                            location=Location(
                                                                line=18,
                                                                column=25,
                                                                line_end=18,
                                                                column_end=39,
                                                            ),
                                                        ),
                                                        location=Location(
                                                            line=18,
                                                            column=17,
                                                            line_end=18,
                                                            column_end=39,
                                                        ),
                                                    ),
                                                ],
                                                location=Location(
                                                    line=12,
                                                    column=46,
                                                    line_end=19,
                                                    column_end=16,
                                                ),
                                            ),
                                            location=Location(
                                                line=12,
                                                column=40,
                                                line_end=19,
                                                column_end=16,
                                            ),
                                        ),
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=12,
                                        column=15,
                                        line_end=19,
                                        column_end=17,
                                    ),
                                ),
                            ],
                            location=Location(
                                line=2, column=19, line_end=20, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=20, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=20, column_end=14
                ),
            ),
        ),
        (
            """
            fragment MyTypeFields on MyType @debug(if: true) {
              ... on MyType @debug(if: true) {
                aMyTypeField: myTypeField
              }
            }

            query {
              ... @include(if: false) {
                myType {
                  ...MyTypeFields
                }
              }
            }
            """,
            DocumentNode(
                definitions=[
                    FragmentDefinitionNode(
                        name=NameNode(
                            value="MyTypeFields",
                            location=Location(
                                line=2, column=22, line_end=2, column_end=34
                            ),
                        ),
                        type_condition=NamedTypeNode(
                            name=NameNode(
                                value="MyType",
                                location=Location(
                                    line=2,
                                    column=38,
                                    line_end=2,
                                    column_end=44,
                                ),
                            ),
                            location=Location(
                                line=2, column=38, line_end=2, column_end=44
                            ),
                        ),
                        directives=[
                            DirectiveNode(
                                name=NameNode(
                                    value="debug",
                                    location=Location(
                                        line=2,
                                        column=46,
                                        line_end=2,
                                        column_end=51,
                                    ),
                                ),
                                arguments=[
                                    ArgumentNode(
                                        name=NameNode(
                                            value="if",
                                            location=Location(
                                                line=2,
                                                column=52,
                                                line_end=2,
                                                column_end=54,
                                            ),
                                        ),
                                        value=BooleanValueNode(
                                            value=True,
                                            location=Location(
                                                line=2,
                                                column=56,
                                                line_end=2,
                                                column_end=60,
                                            ),
                                        ),
                                        location=Location(
                                            line=2,
                                            column=52,
                                            line_end=2,
                                            column_end=60,
                                        ),
                                    )
                                ],
                                location=Location(
                                    line=2,
                                    column=45,
                                    line_end=2,
                                    column_end=61,
                                ),
                            )
                        ],
                        selection_set=SelectionSetNode(
                            selections=[
                                InlineFragmentNode(
                                    type_condition=NamedTypeNode(
                                        name=NameNode(
                                            value="MyType",
                                            location=Location(
                                                line=3,
                                                column=22,
                                                line_end=3,
                                                column_end=28,
                                            ),
                                        ),
                                        location=Location(
                                            line=3,
                                            column=22,
                                            line_end=3,
                                            column_end=28,
                                        ),
                                    ),
                                    directives=[
                                        DirectiveNode(
                                            name=NameNode(
                                                value="debug",
                                                location=Location(
                                                    line=3,
                                                    column=30,
                                                    line_end=3,
                                                    column_end=35,
                                                ),
                                            ),
                                            arguments=[
                                                ArgumentNode(
                                                    name=NameNode(
                                                        value="if",
                                                        location=Location(
                                                            line=3,
                                                            column=36,
                                                            line_end=3,
                                                            column_end=38,
                                                        ),
                                                    ),
                                                    value=BooleanValueNode(
                                                        value=True,
                                                        location=Location(
                                                            line=3,
                                                            column=40,
                                                            line_end=3,
                                                            column_end=44,
                                                        ),
                                                    ),
                                                    location=Location(
                                                        line=3,
                                                        column=36,
                                                        line_end=3,
                                                        column_end=44,
                                                    ),
                                                )
                                            ],
                                            location=Location(
                                                line=3,
                                                column=29,
                                                line_end=3,
                                                column_end=45,
                                            ),
                                        )
                                    ],
                                    selection_set=SelectionSetNode(
                                        selections=[
                                            FieldNode(
                                                alias=NameNode(
                                                    value="aMyTypeField",
                                                    location=Location(
                                                        line=4,
                                                        column=17,
                                                        line_end=4,
                                                        column_end=29,
                                                    ),
                                                ),
                                                name=NameNode(
                                                    value="myTypeField",
                                                    location=Location(
                                                        line=4,
                                                        column=31,
                                                        line_end=4,
                                                        column_end=42,
                                                    ),
                                                ),
                                                arguments=[],
                                                directives=[],
                                                selection_set=None,
                                                location=Location(
                                                    line=4,
                                                    column=17,
                                                    line_end=4,
                                                    column_end=42,
                                                ),
                                            )
                                        ],
                                        location=Location(
                                            line=3,
                                            column=46,
                                            line_end=5,
                                            column_end=16,
                                        ),
                                    ),
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=5,
                                        column_end=16,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=62, line_end=6, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=6, column_end=14
                        ),
                    ),
                    OperationDefinitionNode(
                        operation_type="query",
                        name=None,
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                InlineFragmentNode(
                                    type_condition=None,
                                    directives=[
                                        DirectiveNode(
                                            name=NameNode(
                                                value="include",
                                                location=Location(
                                                    line=9,
                                                    column=20,
                                                    line_end=9,
                                                    column_end=27,
                                                ),
                                            ),
                                            arguments=[
                                                ArgumentNode(
                                                    name=NameNode(
                                                        value="if",
                                                        location=Location(
                                                            line=9,
                                                            column=28,
                                                            line_end=9,
                                                            column_end=30,
                                                        ),
                                                    ),
                                                    value=BooleanValueNode(
                                                        value=False,
                                                        location=Location(
                                                            line=9,
                                                            column=32,
                                                            line_end=9,
                                                            column_end=37,
                                                        ),
                                                    ),
                                                    location=Location(
                                                        line=9,
                                                        column=28,
                                                        line_end=9,
                                                        column_end=37,
                                                    ),
                                                )
                                            ],
                                            location=Location(
                                                line=9,
                                                column=19,
                                                line_end=9,
                                                column_end=38,
                                            ),
                                        )
                                    ],
                                    selection_set=SelectionSetNode(
                                        selections=[
                                            FieldNode(
                                                alias=None,
                                                name=NameNode(
                                                    value="myType",
                                                    location=Location(
                                                        line=10,
                                                        column=17,
                                                        line_end=10,
                                                        column_end=23,
                                                    ),
                                                ),
                                                arguments=[],
                                                directives=[],
                                                selection_set=SelectionSetNode(
                                                    selections=[
                                                        FragmentSpreadNode(
                                                            name=NameNode(
                                                                value="MyTypeFields",
                                                                location=Location(
                                                                    line=11,
                                                                    column=22,
                                                                    line_end=11,
                                                                    column_end=34,
                                                                ),
                                                            ),
                                                            directives=[],
                                                            location=Location(
                                                                line=11,
                                                                column=19,
                                                                line_end=11,
                                                                column_end=34,
                                                            ),
                                                        )
                                                    ],
                                                    location=Location(
                                                        line=10,
                                                        column=24,
                                                        line_end=12,
                                                        column_end=18,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=10,
                                                    column=17,
                                                    line_end=12,
                                                    column_end=18,
                                                ),
                                            )
                                        ],
                                        location=Location(
                                            line=9,
                                            column=39,
                                            line_end=13,
                                            column_end=16,
                                        ),
                                    ),
                                    location=Location(
                                        line=9,
                                        column=15,
                                        line_end=13,
                                        column_end=16,
                                    ),
                                )
                            ],
                            location=Location(
                                line=8, column=19, line_end=14, column_end=14
                            ),
                        ),
                        location=Location(
                            line=8, column=13, line_end=14, column_end=14
                        ),
                    ),
                ],
                location=Location(
                    line=2, column=13, line_end=14, column_end=14
                ),
            ),
        ),
        (
            """
            query($nonNullList: [MyType!]!) {
              nonsenseField(nonsenseArg: $nonNullList)
            }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="query",
                        name=None,
                        variable_definitions=[
                            VariableDefinitionNode(
                                variable=VariableNode(
                                    name=NameNode(
                                        value="nonNullList",
                                        location=Location(
                                            line=2,
                                            column=19,
                                            line_end=2,
                                            column_end=31,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=19,
                                        line_end=2,
                                        column_end=31,
                                    ),
                                ),
                                type=NonNullTypeNode(
                                    type=ListTypeNode(
                                        type=NonNullTypeNode(
                                            type=NamedTypeNode(
                                                name=NameNode(
                                                    value="MyType",
                                                    location=Location(
                                                        line=2,
                                                        column=34,
                                                        line_end=2,
                                                        column_end=40,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=2,
                                                    column=34,
                                                    line_end=2,
                                                    column_end=40,
                                                ),
                                            ),
                                            location=Location(
                                                line=2,
                                                column=34,
                                                line_end=2,
                                                column_end=41,
                                            ),
                                        ),
                                        location=Location(
                                            line=2,
                                            column=33,
                                            line_end=2,
                                            column_end=42,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=33,
                                        line_end=2,
                                        column_end=43,
                                    ),
                                ),
                                default_value=None,
                                location=Location(
                                    line=2,
                                    column=19,
                                    line_end=2,
                                    column_end=43,
                                ),
                            )
                        ],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="nonsenseField",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=28,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="nonsenseArg",
                                                location=Location(
                                                    line=3,
                                                    column=29,
                                                    line_end=3,
                                                    column_end=40,
                                                ),
                                            ),
                                            value=VariableNode(
                                                name=NameNode(
                                                    value="nonNullList",
                                                    location=Location(
                                                        line=3,
                                                        column=42,
                                                        line_end=3,
                                                        column_end=54,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=3,
                                                    column=42,
                                                    line_end=3,
                                                    column_end=54,
                                                ),
                                            ),
                                            location=Location(
                                                line=3,
                                                column=29,
                                                line_end=3,
                                                column_end=54,
                                            ),
                                        )
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=3,
                                        column_end=55,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=45, line_end=4, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=4, column_end=14
                        ),
                    )
                ],
                location=Location(
                    line=2, column=13, line_end=4, column_end=14
                ),
            ),
        ),
        (
            """
            query queryName($foo: ComplexType, $site: Site = MOBILE) @onQuery {
              whoever123is: node(id: [123, 456]) {
                id ,
                ... on User @onInlineFragment {
                  field2 {
                    id ,
                    alias: field1(first:10, after:$foo,) @include(if: $foo) {
                      id,
                      ...frag @onFragmentSpread
                    }
                  }
                }
                ... @skip(unless: $foo) {
                  id
                }
                ... {
                  id
                }
              }
            }

            mutation likeStory @onMutation {
              like(story: 123) @onField {
                story {
                  id @onField
                }
              }
            }

            subscription StoryLikeSubscription(
              $input: StoryLikeSubscribeInput
            ) @onSubscription {
              storyLikeSubscribe(input: $input) {
                story {
                  likers {
                    count
                  }
                  likeSentence {
                    text
                  }
                }
              }
            }

            fragment frag on Friend @onFragmentDefinition {
              foo(size: $size, bar: $b, obj: {key: "value"})
            }

            {
              unnamed(truthy: true, falsey: false, nullish: null),
              query
            }

            query { __typename }
            """,
            DocumentNode(
                definitions=[
                    OperationDefinitionNode(
                        operation_type="query",
                        name=NameNode(
                            value="queryName",
                            location=Location(
                                line=2, column=19, line_end=2, column_end=28
                            ),
                        ),
                        variable_definitions=[
                            VariableDefinitionNode(
                                variable=VariableNode(
                                    name=NameNode(
                                        value="foo",
                                        location=Location(
                                            line=2,
                                            column=29,
                                            line_end=2,
                                            column_end=33,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=29,
                                        line_end=2,
                                        column_end=33,
                                    ),
                                ),
                                type=NamedTypeNode(
                                    name=NameNode(
                                        value="ComplexType",
                                        location=Location(
                                            line=2,
                                            column=35,
                                            line_end=2,
                                            column_end=46,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=35,
                                        line_end=2,
                                        column_end=46,
                                    ),
                                ),
                                default_value=None,
                                location=Location(
                                    line=2,
                                    column=29,
                                    line_end=2,
                                    column_end=46,
                                ),
                            ),
                            VariableDefinitionNode(
                                variable=VariableNode(
                                    name=NameNode(
                                        value="site",
                                        location=Location(
                                            line=2,
                                            column=48,
                                            line_end=2,
                                            column_end=53,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=48,
                                        line_end=2,
                                        column_end=53,
                                    ),
                                ),
                                type=NamedTypeNode(
                                    name=NameNode(
                                        value="Site",
                                        location=Location(
                                            line=2,
                                            column=55,
                                            line_end=2,
                                            column_end=59,
                                        ),
                                    ),
                                    location=Location(
                                        line=2,
                                        column=55,
                                        line_end=2,
                                        column_end=59,
                                    ),
                                ),
                                default_value=EnumValueNode(
                                    value="MOBILE",
                                    location=Location(
                                        line=2,
                                        column=62,
                                        line_end=2,
                                        column_end=68,
                                    ),
                                ),
                                location=Location(
                                    line=2,
                                    column=48,
                                    line_end=2,
                                    column_end=68,
                                ),
                            ),
                        ],
                        directives=[
                            DirectiveNode(
                                name=NameNode(
                                    value="onQuery",
                                    location=Location(
                                        line=2,
                                        column=71,
                                        line_end=2,
                                        column_end=78,
                                    ),
                                ),
                                arguments=[],
                                location=Location(
                                    line=2,
                                    column=70,
                                    line_end=2,
                                    column_end=78,
                                ),
                            )
                        ],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=NameNode(
                                        value="whoever123is",
                                        location=Location(
                                            line=3,
                                            column=15,
                                            line_end=3,
                                            column_end=27,
                                        ),
                                    ),
                                    name=NameNode(
                                        value="node",
                                        location=Location(
                                            line=3,
                                            column=29,
                                            line_end=3,
                                            column_end=33,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="id",
                                                location=Location(
                                                    line=3,
                                                    column=34,
                                                    line_end=3,
                                                    column_end=36,
                                                ),
                                            ),
                                            value=ListValueNode(
                                                values=[
                                                    IntValueNode(
                                                        value=123,
                                                        location=Location(
                                                            line=3,
                                                            column=39,
                                                            line_end=3,
                                                            column_end=42,
                                                        ),
                                                    ),
                                                    IntValueNode(
                                                        value=456,
                                                        location=Location(
                                                            line=3,
                                                            column=44,
                                                            line_end=3,
                                                            column_end=47,
                                                        ),
                                                    ),
                                                ],
                                                location=Location(
                                                    line=3,
                                                    column=38,
                                                    line_end=3,
                                                    column_end=48,
                                                ),
                                            ),
                                            location=Location(
                                                line=3,
                                                column=34,
                                                line_end=3,
                                                column_end=48,
                                            ),
                                        )
                                    ],
                                    directives=[],
                                    selection_set=SelectionSetNode(
                                        selections=[
                                            FieldNode(
                                                alias=None,
                                                name=NameNode(
                                                    value="id",
                                                    location=Location(
                                                        line=4,
                                                        column=17,
                                                        line_end=4,
                                                        column_end=19,
                                                    ),
                                                ),
                                                arguments=[],
                                                directives=[],
                                                selection_set=None,
                                                location=Location(
                                                    line=4,
                                                    column=17,
                                                    line_end=4,
                                                    column_end=19,
                                                ),
                                            ),
                                            InlineFragmentNode(
                                                type_condition=NamedTypeNode(
                                                    name=NameNode(
                                                        value="User",
                                                        location=Location(
                                                            line=5,
                                                            column=24,
                                                            line_end=5,
                                                            column_end=28,
                                                        ),
                                                    ),
                                                    location=Location(
                                                        line=5,
                                                        column=24,
                                                        line_end=5,
                                                        column_end=28,
                                                    ),
                                                ),
                                                directives=[
                                                    DirectiveNode(
                                                        name=NameNode(
                                                            value="onInlineFragment",
                                                            location=Location(
                                                                line=5,
                                                                column=30,
                                                                line_end=5,
                                                                column_end=46,
                                                            ),
                                                        ),
                                                        arguments=[],
                                                        location=Location(
                                                            line=5,
                                                            column=29,
                                                            line_end=5,
                                                            column_end=46,
                                                        ),
                                                    )
                                                ],
                                                selection_set=SelectionSetNode(
                                                    selections=[
                                                        FieldNode(
                                                            alias=None,
                                                            name=NameNode(
                                                                value="field2",
                                                                location=Location(
                                                                    line=6,
                                                                    column=19,
                                                                    line_end=6,
                                                                    column_end=25,
                                                                ),
                                                            ),
                                                            arguments=[],
                                                            directives=[],
                                                            selection_set=SelectionSetNode(
                                                                selections=[
                                                                    FieldNode(
                                                                        alias=None,
                                                                        name=NameNode(
                                                                            value="id",
                                                                            location=Location(
                                                                                line=7,
                                                                                column=21,
                                                                                line_end=7,
                                                                                column_end=23,
                                                                            ),
                                                                        ),
                                                                        arguments=[],
                                                                        directives=[],
                                                                        selection_set=None,
                                                                        location=Location(
                                                                            line=7,
                                                                            column=21,
                                                                            line_end=7,
                                                                            column_end=23,
                                                                        ),
                                                                    ),
                                                                    FieldNode(
                                                                        alias=NameNode(
                                                                            value="alias",
                                                                            location=Location(
                                                                                line=8,
                                                                                column=21,
                                                                                line_end=8,
                                                                                column_end=26,
                                                                            ),
                                                                        ),
                                                                        name=NameNode(
                                                                            value="field1",
                                                                            location=Location(
                                                                                line=8,
                                                                                column=28,
                                                                                line_end=8,
                                                                                column_end=34,
                                                                            ),
                                                                        ),
                                                                        arguments=[
                                                                            ArgumentNode(
                                                                                name=NameNode(
                                                                                    value="first",
                                                                                    location=Location(
                                                                                        line=8,
                                                                                        column=35,
                                                                                        line_end=8,
                                                                                        column_end=40,
                                                                                    ),
                                                                                ),
                                                                                value=IntValueNode(
                                                                                    value=10,
                                                                                    location=Location(
                                                                                        line=8,
                                                                                        column=41,
                                                                                        line_end=8,
                                                                                        column_end=43,
                                                                                    ),
                                                                                ),
                                                                                location=Location(
                                                                                    line=8,
                                                                                    column=35,
                                                                                    line_end=8,
                                                                                    column_end=43,
                                                                                ),
                                                                            ),
                                                                            ArgumentNode(
                                                                                name=NameNode(
                                                                                    value="after",
                                                                                    location=Location(
                                                                                        line=8,
                                                                                        column=45,
                                                                                        line_end=8,
                                                                                        column_end=50,
                                                                                    ),
                                                                                ),
                                                                                value=VariableNode(
                                                                                    name=NameNode(
                                                                                        value="foo",
                                                                                        location=Location(
                                                                                            line=8,
                                                                                            column=51,
                                                                                            line_end=8,
                                                                                            column_end=55,
                                                                                        ),
                                                                                    ),
                                                                                    location=Location(
                                                                                        line=8,
                                                                                        column=51,
                                                                                        line_end=8,
                                                                                        column_end=55,
                                                                                    ),
                                                                                ),
                                                                                location=Location(
                                                                                    line=8,
                                                                                    column=45,
                                                                                    line_end=8,
                                                                                    column_end=55,
                                                                                ),
                                                                            ),
                                                                        ],
                                                                        directives=[
                                                                            DirectiveNode(
                                                                                name=NameNode(
                                                                                    value="include",
                                                                                    location=Location(
                                                                                        line=8,
                                                                                        column=59,
                                                                                        line_end=8,
                                                                                        column_end=66,
                                                                                    ),
                                                                                ),
                                                                                arguments=[
                                                                                    ArgumentNode(
                                                                                        name=NameNode(
                                                                                            value="if",
                                                                                            location=Location(
                                                                                                line=8,
                                                                                                column=67,
                                                                                                line_end=8,
                                                                                                column_end=69,
                                                                                            ),
                                                                                        ),
                                                                                        value=VariableNode(
                                                                                            name=NameNode(
                                                                                                value="foo",
                                                                                                location=Location(
                                                                                                    line=8,
                                                                                                    column=71,
                                                                                                    line_end=8,
                                                                                                    column_end=75,
                                                                                                ),
                                                                                            ),
                                                                                            location=Location(
                                                                                                line=8,
                                                                                                column=71,
                                                                                                line_end=8,
                                                                                                column_end=75,
                                                                                            ),
                                                                                        ),
                                                                                        location=Location(
                                                                                            line=8,
                                                                                            column=67,
                                                                                            line_end=8,
                                                                                            column_end=75,
                                                                                        ),
                                                                                    )
                                                                                ],
                                                                                location=Location(
                                                                                    line=8,
                                                                                    column=58,
                                                                                    line_end=8,
                                                                                    column_end=76,
                                                                                ),
                                                                            )
                                                                        ],
                                                                        selection_set=SelectionSetNode(
                                                                            selections=[
                                                                                FieldNode(
                                                                                    alias=None,
                                                                                    name=NameNode(
                                                                                        value="id",
                                                                                        location=Location(
                                                                                            line=9,
                                                                                            column=23,
                                                                                            line_end=9,
                                                                                            column_end=25,
                                                                                        ),
                                                                                    ),
                                                                                    arguments=[],
                                                                                    directives=[],
                                                                                    selection_set=None,
                                                                                    location=Location(
                                                                                        line=9,
                                                                                        column=23,
                                                                                        line_end=9,
                                                                                        column_end=25,
                                                                                    ),
                                                                                ),
                                                                                FragmentSpreadNode(
                                                                                    name=NameNode(
                                                                                        value="frag",
                                                                                        location=Location(
                                                                                            line=10,
                                                                                            column=26,
                                                                                            line_end=10,
                                                                                            column_end=30,
                                                                                        ),
                                                                                    ),
                                                                                    directives=[
                                                                                        DirectiveNode(
                                                                                            name=NameNode(
                                                                                                value="onFragmentSpread",
                                                                                                location=Location(
                                                                                                    line=10,
                                                                                                    column=32,
                                                                                                    line_end=10,
                                                                                                    column_end=48,
                                                                                                ),
                                                                                            ),
                                                                                            arguments=[],
                                                                                            location=Location(
                                                                                                line=10,
                                                                                                column=31,
                                                                                                line_end=10,
                                                                                                column_end=48,
                                                                                            ),
                                                                                        )
                                                                                    ],
                                                                                    location=Location(
                                                                                        line=10,
                                                                                        column=23,
                                                                                        line_end=10,
                                                                                        column_end=48,
                                                                                    ),
                                                                                ),
                                                                            ],
                                                                            location=Location(
                                                                                line=8,
                                                                                column=77,
                                                                                line_end=11,
                                                                                column_end=22,
                                                                            ),
                                                                        ),
                                                                        location=Location(
                                                                            line=8,
                                                                            column=21,
                                                                            line_end=11,
                                                                            column_end=22,
                                                                        ),
                                                                    ),
                                                                ],
                                                                location=Location(
                                                                    line=6,
                                                                    column=26,
                                                                    line_end=12,
                                                                    column_end=20,
                                                                ),
                                                            ),
                                                            location=Location(
                                                                line=6,
                                                                column=19,
                                                                line_end=12,
                                                                column_end=20,
                                                            ),
                                                        )
                                                    ],
                                                    location=Location(
                                                        line=5,
                                                        column=47,
                                                        line_end=13,
                                                        column_end=18,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=5,
                                                    column=17,
                                                    line_end=13,
                                                    column_end=18,
                                                ),
                                            ),
                                            InlineFragmentNode(
                                                type_condition=None,
                                                directives=[
                                                    DirectiveNode(
                                                        name=NameNode(
                                                            value="skip",
                                                            location=Location(
                                                                line=14,
                                                                column=22,
                                                                line_end=14,
                                                                column_end=26,
                                                            ),
                                                        ),
                                                        arguments=[
                                                            ArgumentNode(
                                                                name=NameNode(
                                                                    value="unless",
                                                                    location=Location(
                                                                        line=14,
                                                                        column=27,
                                                                        line_end=14,
                                                                        column_end=33,
                                                                    ),
                                                                ),
                                                                value=VariableNode(
                                                                    name=NameNode(
                                                                        value="foo",
                                                                        location=Location(
                                                                            line=14,
                                                                            column=35,
                                                                            line_end=14,
                                                                            column_end=39,
                                                                        ),
                                                                    ),
                                                                    location=Location(
                                                                        line=14,
                                                                        column=35,
                                                                        line_end=14,
                                                                        column_end=39,
                                                                    ),
                                                                ),
                                                                location=Location(
                                                                    line=14,
                                                                    column=27,
                                                                    line_end=14,
                                                                    column_end=39,
                                                                ),
                                                            )
                                                        ],
                                                        location=Location(
                                                            line=14,
                                                            column=21,
                                                            line_end=14,
                                                            column_end=40,
                                                        ),
                                                    )
                                                ],
                                                selection_set=SelectionSetNode(
                                                    selections=[
                                                        FieldNode(
                                                            alias=None,
                                                            name=NameNode(
                                                                value="id",
                                                                location=Location(
                                                                    line=15,
                                                                    column=19,
                                                                    line_end=15,
                                                                    column_end=21,
                                                                ),
                                                            ),
                                                            arguments=[],
                                                            directives=[],
                                                            selection_set=None,
                                                            location=Location(
                                                                line=15,
                                                                column=19,
                                                                line_end=15,
                                                                column_end=21,
                                                            ),
                                                        )
                                                    ],
                                                    location=Location(
                                                        line=14,
                                                        column=41,
                                                        line_end=16,
                                                        column_end=18,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=14,
                                                    column=17,
                                                    line_end=16,
                                                    column_end=18,
                                                ),
                                            ),
                                            InlineFragmentNode(
                                                type_condition=None,
                                                directives=[],
                                                selection_set=SelectionSetNode(
                                                    selections=[
                                                        FieldNode(
                                                            alias=None,
                                                            name=NameNode(
                                                                value="id",
                                                                location=Location(
                                                                    line=18,
                                                                    column=19,
                                                                    line_end=18,
                                                                    column_end=21,
                                                                ),
                                                            ),
                                                            arguments=[],
                                                            directives=[],
                                                            selection_set=None,
                                                            location=Location(
                                                                line=18,
                                                                column=19,
                                                                line_end=18,
                                                                column_end=21,
                                                            ),
                                                        )
                                                    ],
                                                    location=Location(
                                                        line=17,
                                                        column=21,
                                                        line_end=19,
                                                        column_end=18,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=17,
                                                    column=17,
                                                    line_end=19,
                                                    column_end=18,
                                                ),
                                            ),
                                        ],
                                        location=Location(
                                            line=3,
                                            column=50,
                                            line_end=20,
                                            column_end=16,
                                        ),
                                    ),
                                    location=Location(
                                        line=3,
                                        column=15,
                                        line_end=20,
                                        column_end=16,
                                    ),
                                )
                            ],
                            location=Location(
                                line=2, column=79, line_end=21, column_end=14
                            ),
                        ),
                        location=Location(
                            line=2, column=13, line_end=21, column_end=14
                        ),
                    ),
                    OperationDefinitionNode(
                        operation_type="mutation",
                        name=NameNode(
                            value="likeStory",
                            location=Location(
                                line=23, column=22, line_end=23, column_end=31
                            ),
                        ),
                        variable_definitions=[],
                        directives=[
                            DirectiveNode(
                                name=NameNode(
                                    value="onMutation",
                                    location=Location(
                                        line=23,
                                        column=33,
                                        line_end=23,
                                        column_end=43,
                                    ),
                                ),
                                arguments=[],
                                location=Location(
                                    line=23,
                                    column=32,
                                    line_end=23,
                                    column_end=43,
                                ),
                            )
                        ],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="like",
                                        location=Location(
                                            line=24,
                                            column=15,
                                            line_end=24,
                                            column_end=19,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="story",
                                                location=Location(
                                                    line=24,
                                                    column=20,
                                                    line_end=24,
                                                    column_end=25,
                                                ),
                                            ),
                                            value=IntValueNode(
                                                value=123,
                                                location=Location(
                                                    line=24,
                                                    column=27,
                                                    line_end=24,
                                                    column_end=30,
                                                ),
                                            ),
                                            location=Location(
                                                line=24,
                                                column=20,
                                                line_end=24,
                                                column_end=30,
                                            ),
                                        )
                                    ],
                                    directives=[
                                        DirectiveNode(
                                            name=NameNode(
                                                value="onField",
                                                location=Location(
                                                    line=24,
                                                    column=33,
                                                    line_end=24,
                                                    column_end=40,
                                                ),
                                            ),
                                            arguments=[],
                                            location=Location(
                                                line=24,
                                                column=32,
                                                line_end=24,
                                                column_end=40,
                                            ),
                                        )
                                    ],
                                    selection_set=SelectionSetNode(
                                        selections=[
                                            FieldNode(
                                                alias=None,
                                                name=NameNode(
                                                    value="story",
                                                    location=Location(
                                                        line=25,
                                                        column=17,
                                                        line_end=25,
                                                        column_end=22,
                                                    ),
                                                ),
                                                arguments=[],
                                                directives=[],
                                                selection_set=SelectionSetNode(
                                                    selections=[
                                                        FieldNode(
                                                            alias=None,
                                                            name=NameNode(
                                                                value="id",
                                                                location=Location(
                                                                    line=26,
                                                                    column=19,
                                                                    line_end=26,
                                                                    column_end=21,
                                                                ),
                                                            ),
                                                            arguments=[],
                                                            directives=[
                                                                DirectiveNode(
                                                                    name=NameNode(
                                                                        value="onField",
                                                                        location=Location(
                                                                            line=26,
                                                                            column=23,
                                                                            line_end=26,
                                                                            column_end=30,
                                                                        ),
                                                                    ),
                                                                    arguments=[],
                                                                    location=Location(
                                                                        line=26,
                                                                        column=22,
                                                                        line_end=26,
                                                                        column_end=30,
                                                                    ),
                                                                )
                                                            ],
                                                            selection_set=None,
                                                            location=Location(
                                                                line=26,
                                                                column=19,
                                                                line_end=26,
                                                                column_end=30,
                                                            ),
                                                        )
                                                    ],
                                                    location=Location(
                                                        line=25,
                                                        column=23,
                                                        line_end=27,
                                                        column_end=18,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=25,
                                                    column=17,
                                                    line_end=27,
                                                    column_end=18,
                                                ),
                                            )
                                        ],
                                        location=Location(
                                            line=24,
                                            column=41,
                                            line_end=28,
                                            column_end=16,
                                        ),
                                    ),
                                    location=Location(
                                        line=24,
                                        column=15,
                                        line_end=28,
                                        column_end=16,
                                    ),
                                )
                            ],
                            location=Location(
                                line=23, column=44, line_end=29, column_end=14
                            ),
                        ),
                        location=Location(
                            line=23, column=13, line_end=29, column_end=14
                        ),
                    ),
                    OperationDefinitionNode(
                        operation_type="subscription",
                        name=NameNode(
                            value="StoryLikeSubscription",
                            location=Location(
                                line=31, column=26, line_end=31, column_end=47
                            ),
                        ),
                        variable_definitions=[
                            VariableDefinitionNode(
                                variable=VariableNode(
                                    name=NameNode(
                                        value="input",
                                        location=Location(
                                            line=32,
                                            column=15,
                                            line_end=32,
                                            column_end=21,
                                        ),
                                    ),
                                    location=Location(
                                        line=32,
                                        column=15,
                                        line_end=32,
                                        column_end=21,
                                    ),
                                ),
                                type=NamedTypeNode(
                                    name=NameNode(
                                        value="StoryLikeSubscribeInput",
                                        location=Location(
                                            line=32,
                                            column=23,
                                            line_end=32,
                                            column_end=46,
                                        ),
                                    ),
                                    location=Location(
                                        line=32,
                                        column=23,
                                        line_end=32,
                                        column_end=46,
                                    ),
                                ),
                                default_value=None,
                                location=Location(
                                    line=32,
                                    column=15,
                                    line_end=32,
                                    column_end=46,
                                ),
                            )
                        ],
                        directives=[
                            DirectiveNode(
                                name=NameNode(
                                    value="onSubscription",
                                    location=Location(
                                        line=33,
                                        column=16,
                                        line_end=33,
                                        column_end=30,
                                    ),
                                ),
                                arguments=[],
                                location=Location(
                                    line=33,
                                    column=15,
                                    line_end=33,
                                    column_end=30,
                                ),
                            )
                        ],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="storyLikeSubscribe",
                                        location=Location(
                                            line=34,
                                            column=15,
                                            line_end=34,
                                            column_end=33,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="input",
                                                location=Location(
                                                    line=34,
                                                    column=34,
                                                    line_end=34,
                                                    column_end=39,
                                                ),
                                            ),
                                            value=VariableNode(
                                                name=NameNode(
                                                    value="input",
                                                    location=Location(
                                                        line=34,
                                                        column=41,
                                                        line_end=34,
                                                        column_end=47,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=34,
                                                    column=41,
                                                    line_end=34,
                                                    column_end=47,
                                                ),
                                            ),
                                            location=Location(
                                                line=34,
                                                column=34,
                                                line_end=34,
                                                column_end=47,
                                            ),
                                        )
                                    ],
                                    directives=[],
                                    selection_set=SelectionSetNode(
                                        selections=[
                                            FieldNode(
                                                alias=None,
                                                name=NameNode(
                                                    value="story",
                                                    location=Location(
                                                        line=35,
                                                        column=17,
                                                        line_end=35,
                                                        column_end=22,
                                                    ),
                                                ),
                                                arguments=[],
                                                directives=[],
                                                selection_set=SelectionSetNode(
                                                    selections=[
                                                        FieldNode(
                                                            alias=None,
                                                            name=NameNode(
                                                                value="likers",
                                                                location=Location(
                                                                    line=36,
                                                                    column=19,
                                                                    line_end=36,
                                                                    column_end=25,
                                                                ),
                                                            ),
                                                            arguments=[],
                                                            directives=[],
                                                            selection_set=SelectionSetNode(
                                                                selections=[
                                                                    FieldNode(
                                                                        alias=None,
                                                                        name=NameNode(
                                                                            value="count",
                                                                            location=Location(
                                                                                line=37,
                                                                                column=21,
                                                                                line_end=37,
                                                                                column_end=26,
                                                                            ),
                                                                        ),
                                                                        arguments=[],
                                                                        directives=[],
                                                                        selection_set=None,
                                                                        location=Location(
                                                                            line=37,
                                                                            column=21,
                                                                            line_end=37,
                                                                            column_end=26,
                                                                        ),
                                                                    )
                                                                ],
                                                                location=Location(
                                                                    line=36,
                                                                    column=26,
                                                                    line_end=38,
                                                                    column_end=20,
                                                                ),
                                                            ),
                                                            location=Location(
                                                                line=36,
                                                                column=19,
                                                                line_end=38,
                                                                column_end=20,
                                                            ),
                                                        ),
                                                        FieldNode(
                                                            alias=None,
                                                            name=NameNode(
                                                                value="likeSentence",
                                                                location=Location(
                                                                    line=39,
                                                                    column=19,
                                                                    line_end=39,
                                                                    column_end=31,
                                                                ),
                                                            ),
                                                            arguments=[],
                                                            directives=[],
                                                            selection_set=SelectionSetNode(
                                                                selections=[
                                                                    FieldNode(
                                                                        alias=None,
                                                                        name=NameNode(
                                                                            value="text",
                                                                            location=Location(
                                                                                line=40,
                                                                                column=21,
                                                                                line_end=40,
                                                                                column_end=25,
                                                                            ),
                                                                        ),
                                                                        arguments=[],
                                                                        directives=[],
                                                                        selection_set=None,
                                                                        location=Location(
                                                                            line=40,
                                                                            column=21,
                                                                            line_end=40,
                                                                            column_end=25,
                                                                        ),
                                                                    )
                                                                ],
                                                                location=Location(
                                                                    line=39,
                                                                    column=32,
                                                                    line_end=41,
                                                                    column_end=20,
                                                                ),
                                                            ),
                                                            location=Location(
                                                                line=39,
                                                                column=19,
                                                                line_end=41,
                                                                column_end=20,
                                                            ),
                                                        ),
                                                    ],
                                                    location=Location(
                                                        line=35,
                                                        column=23,
                                                        line_end=42,
                                                        column_end=18,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=35,
                                                    column=17,
                                                    line_end=42,
                                                    column_end=18,
                                                ),
                                            )
                                        ],
                                        location=Location(
                                            line=34,
                                            column=49,
                                            line_end=43,
                                            column_end=16,
                                        ),
                                    ),
                                    location=Location(
                                        line=34,
                                        column=15,
                                        line_end=43,
                                        column_end=16,
                                    ),
                                )
                            ],
                            location=Location(
                                line=33, column=31, line_end=44, column_end=14
                            ),
                        ),
                        location=Location(
                            line=31, column=13, line_end=44, column_end=14
                        ),
                    ),
                    FragmentDefinitionNode(
                        name=NameNode(
                            value="frag",
                            location=Location(
                                line=46, column=22, line_end=46, column_end=26
                            ),
                        ),
                        type_condition=NamedTypeNode(
                            name=NameNode(
                                value="Friend",
                                location=Location(
                                    line=46,
                                    column=30,
                                    line_end=46,
                                    column_end=36,
                                ),
                            ),
                            location=Location(
                                line=46, column=30, line_end=46, column_end=36
                            ),
                        ),
                        directives=[
                            DirectiveNode(
                                name=NameNode(
                                    value="onFragmentDefinition",
                                    location=Location(
                                        line=46,
                                        column=38,
                                        line_end=46,
                                        column_end=58,
                                    ),
                                ),
                                arguments=[],
                                location=Location(
                                    line=46,
                                    column=37,
                                    line_end=46,
                                    column_end=58,
                                ),
                            )
                        ],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="foo",
                                        location=Location(
                                            line=47,
                                            column=15,
                                            line_end=47,
                                            column_end=18,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="size",
                                                location=Location(
                                                    line=47,
                                                    column=19,
                                                    line_end=47,
                                                    column_end=23,
                                                ),
                                            ),
                                            value=VariableNode(
                                                name=NameNode(
                                                    value="size",
                                                    location=Location(
                                                        line=47,
                                                        column=25,
                                                        line_end=47,
                                                        column_end=30,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=47,
                                                    column=25,
                                                    line_end=47,
                                                    column_end=30,
                                                ),
                                            ),
                                            location=Location(
                                                line=47,
                                                column=19,
                                                line_end=47,
                                                column_end=30,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="bar",
                                                location=Location(
                                                    line=47,
                                                    column=32,
                                                    line_end=47,
                                                    column_end=35,
                                                ),
                                            ),
                                            value=VariableNode(
                                                name=NameNode(
                                                    value="b",
                                                    location=Location(
                                                        line=47,
                                                        column=37,
                                                        line_end=47,
                                                        column_end=39,
                                                    ),
                                                ),
                                                location=Location(
                                                    line=47,
                                                    column=37,
                                                    line_end=47,
                                                    column_end=39,
                                                ),
                                            ),
                                            location=Location(
                                                line=47,
                                                column=32,
                                                line_end=47,
                                                column_end=39,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="obj",
                                                location=Location(
                                                    line=47,
                                                    column=41,
                                                    line_end=47,
                                                    column_end=44,
                                                ),
                                            ),
                                            value=ObjectValueNode(
                                                fields=[
                                                    ObjectFieldNode(
                                                        name=NameNode(
                                                            value="key",
                                                            location=Location(
                                                                line=47,
                                                                column=47,
                                                                line_end=47,
                                                                column_end=50,
                                                            ),
                                                        ),
                                                        value=StringValueNode(
                                                            value="value",
                                                            location=Location(
                                                                line=47,
                                                                column=52,
                                                                line_end=47,
                                                                column_end=59,
                                                            ),
                                                        ),
                                                        location=Location(
                                                            line=47,
                                                            column=47,
                                                            line_end=47,
                                                            column_end=59,
                                                        ),
                                                    )
                                                ],
                                                location=Location(
                                                    line=47,
                                                    column=46,
                                                    line_end=47,
                                                    column_end=60,
                                                ),
                                            ),
                                            location=Location(
                                                line=47,
                                                column=41,
                                                line_end=47,
                                                column_end=60,
                                            ),
                                        ),
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=47,
                                        column=15,
                                        line_end=47,
                                        column_end=61,
                                    ),
                                )
                            ],
                            location=Location(
                                line=46, column=59, line_end=48, column_end=14
                            ),
                        ),
                        location=Location(
                            line=46, column=13, line_end=48, column_end=14
                        ),
                    ),
                    OperationDefinitionNode(
                        operation_type="query",
                        name=None,
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="unnamed",
                                        location=Location(
                                            line=51,
                                            column=15,
                                            line_end=51,
                                            column_end=22,
                                        ),
                                    ),
                                    arguments=[
                                        ArgumentNode(
                                            name=NameNode(
                                                value="truthy",
                                                location=Location(
                                                    line=51,
                                                    column=23,
                                                    line_end=51,
                                                    column_end=29,
                                                ),
                                            ),
                                            value=BooleanValueNode(
                                                value=True,
                                                location=Location(
                                                    line=51,
                                                    column=31,
                                                    line_end=51,
                                                    column_end=35,
                                                ),
                                            ),
                                            location=Location(
                                                line=51,
                                                column=23,
                                                line_end=51,
                                                column_end=35,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="falsey",
                                                location=Location(
                                                    line=51,
                                                    column=37,
                                                    line_end=51,
                                                    column_end=43,
                                                ),
                                            ),
                                            value=BooleanValueNode(
                                                value=False,
                                                location=Location(
                                                    line=51,
                                                    column=45,
                                                    line_end=51,
                                                    column_end=50,
                                                ),
                                            ),
                                            location=Location(
                                                line=51,
                                                column=37,
                                                line_end=51,
                                                column_end=50,
                                            ),
                                        ),
                                        ArgumentNode(
                                            name=NameNode(
                                                value="nullish",
                                                location=Location(
                                                    line=51,
                                                    column=52,
                                                    line_end=51,
                                                    column_end=59,
                                                ),
                                            ),
                                            value=NullValueNode(
                                                location=Location(
                                                    line=51,
                                                    column=61,
                                                    line_end=51,
                                                    column_end=65,
                                                )
                                            ),
                                            location=Location(
                                                line=51,
                                                column=52,
                                                line_end=51,
                                                column_end=65,
                                            ),
                                        ),
                                    ],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=51,
                                        column=15,
                                        line_end=51,
                                        column_end=66,
                                    ),
                                ),
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="query",
                                        location=Location(
                                            line=52,
                                            column=15,
                                            line_end=52,
                                            column_end=20,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=52,
                                        column=15,
                                        line_end=52,
                                        column_end=20,
                                    ),
                                ),
                            ],
                            location=Location(
                                line=50, column=13, line_end=53, column_end=14
                            ),
                        ),
                        location=Location(
                            line=50, column=13, line_end=53, column_end=14
                        ),
                    ),
                    OperationDefinitionNode(
                        operation_type="query",
                        name=None,
                        variable_definitions=[],
                        directives=[],
                        selection_set=SelectionSetNode(
                            selections=[
                                FieldNode(
                                    alias=None,
                                    name=NameNode(
                                        value="__typename",
                                        location=Location(
                                            line=55,
                                            column=21,
                                            line_end=55,
                                            column_end=31,
                                        ),
                                    ),
                                    arguments=[],
                                    directives=[],
                                    selection_set=None,
                                    location=Location(
                                        line=55,
                                        column=21,
                                        line_end=55,
                                        column_end=31,
                                    ),
                                )
                            ],
                            location=Location(
                                line=55, column=19, line_end=55, column_end=33
                            ),
                        ),
                        location=Location(
                            line=55, column=13, line_end=55, column_end=33
                        ),
                    ),
                ],
                location=Location(
                    line=2, column=13, line_end=55, column_end=33
                ),
            ),
        ),
    ],
)
def test_parse_to_document(sdl, expected):
    assert parse_to_document(sdl) == expected
